package dilmaj.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;

import dilmaj.shared.StarEntryVO;

public class StarSearchTriggerButtonHandler implements ClickHandler {
	StarEntryVO baseVO;
	StarPanel basePanel;
	
	public StarSearchTriggerButtonHandler(StarEntryVO baseVO, StarPanel basePanel) {
		this.baseVO=baseVO;
		this.basePanel=basePanel;
	}
	@Override
	public void onClick(ClickEvent event) {
		// TODO Auto-generated method stub
		//StarTablePanel searchPanel=new StarTablePanel();
		StarSearchTriggerButton searchButton=(StarSearchTriggerButton)event.getSource();
		String[] filter=new String[1];
		filter[0]=searchButton.getFilter();
		StarTablePanel searchPanel=new StarTablePanel(filter, filter[0], true, baseVO, basePanel);
		int left=searchButton.getAbsoluteLeft();
		int top=searchButton.getAbsoluteTop();
		int x=searchPanel.getOffsetWidth();
		int y=searchPanel.getOffsetHeight();
		searchPanel.setPopupPosition(left-(x/2), top-(y/2));
		searchPanel.show();
		DataStore.openPanel(searchPanel);
	}

}
